<?php

namespace App\Models\Application;

use Eloquent as Model;
use Illuminate\Database\Eloquent\SoftDeletes;

/**
 * Class Arearec
 * @package App\Models\Application
 * @version July 5, 2018, 10:50 am CST
 *
 * @property \App\Models\Application\Sp sp
 * @property integer sp_id
 * @property string page_id
 * @property string areaid
 * @property string subareaid
 * @property string data
 */
class Arearec extends Model
{
    use SoftDeletes;


    public $table = 'arearecs';
    

    protected $dates = ['deleted_at'];


    public $fillable = [
        'sp_id',
        'page_id',
        'areaid',
        'subareaid',
        'data'
    ];

    /**
     * The attributes that should be casted to native types.
     *
     * @var array
     */
    protected $casts = [
        'sp_id' => 'integer',
        'page_id' => 'integer',
        'areaid' => 'string',
        'subareaid' => 'string',
        'data' => 'string'
    ];

    /**
     * Validation rules
     *
     * @var array
     */
    public static $rules = [
        
    ];

    /**
     * @return \Illuminate\Database\Eloquent\Relations\HasOne
     **/
    public function sp()
    {
        return $this->hasOne(\App\Models\Common\EntityData\Channel\Sp::class, 'id', 'sp_id');
    }

    /**
     * @return \Illuminate\Database\Eloquent\Relations\HasOne
     **/
    public function page()
    {
        return $this->hasOne(\App\Models\Application\Page::class, 'id', 'page_id');
    }

}
